package com.signway.interfacejump.slice;

import com.signway.interfacejump.ResourceTable;
import com.signway.interfacejump.utils.CommonData;
import com.signway.interfacejump.utils.LogUtil;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;

public class SecondAbilitySlice extends AbilitySlice {
    public static final String TAG = CommonData.TAG + SecondAbilitySlice.class.getSimpleName();

    public SecondAbilitySlice() {
        LogUtil.info(TAG, "new");
    }

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_slice_second);
        LogUtil.info(TAG, "onStart");

        Text text = (Text) findComponentById(ResourceTable.Id_text_second);
        text.setClickedListener(comment -> {
//            Intent intent1 = new Intent();
//            Operation operation = new Intent.OperationBuilder()
//                    .withBundleName(getBundleName())
//                    .withAbilityName(CommonData.ABILITY_MAIN2)
//                    .withDeviceId("")
//                    .build();
//            intent1.setOperation(operation);
//            startAbility(intent1);

//            terminateAbility();

            terminate();
        });
    }

    @Override
    protected void onForeground(Intent intent) {
        super.onForeground(intent);
        LogUtil.info(TAG, "onForeground");
    }

    @Override
    protected void onActive() {
        super.onActive();
        LogUtil.info(TAG, "onActive");
    }

    @Override
    protected void onInactive() {
        super.onInactive();
        LogUtil.info(TAG, "onInactive");
    }

    @Override
    protected void onBackground() {
        super.onBackground();
        LogUtil.info(TAG, "onBackground");
    }

    @Override
    protected void onStop() {
        super.onStop();
        LogUtil.info(TAG, "onStop");
    }
}
